#ifndef HISTOGRAM_H
#define HISTOGRAM_H
#include "qcustomplot.h"
#include <QtCharts/QChartView>
#include <QtCharts/QBarSet>
#include <QtCharts/QBarSeries>

class Histogram
{
public:
    Histogram();
    QVector<int> computeHistogram(const QVector<double> &data, int numBins, double minVal, double maxVal);
    QVector<double> computeBinEdges(double minVal, double maxVal, int numBins);
    void plotHistogram(QCustomPlot *customPlot, const QVector<int> &histogram, const QVector<double> &binEdges,QString titleName,QString xAxisName,QString yAxisName);
    void plotHistogram(QChartView *chartView, const std::vector<int> &histogram, const std::vector<double> &binEdges);
    void plotHistogram(QChartView *chartView, const std::vector<int> &histogram);
private:
    void setupLegend(QChart *chart);
    void setupAxes(QChart *chart, QBarSeries *series);
    void setupChartStyle(QChart *chart);

};

#endif // HISTOGRAM_H
